home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / BAS / Graphism / Chaos / data1.cab / Beispieldateien / Formulas / Compiler / ChaosPro.ccl next >
Text File  |  2000-10-04  |  4KB  |  206 lines

  1. comment {
  2. These formulas should imitate FractInt's coloring
  3. options for the formula fractal type.
  4. If you encounter problems, please let me know.
  5. Not all FractInt options work.
  6.  
  7. Enjoy,
  8.   Martin Pfingstl
  9. }
  10.  
  11. Inside {
  12. real z_min,zmodulo;
  13. int iEpsilonCross;
  14. int min_iter,current_iter;
  15. parameter int iInside;
  16. parameter int iColorIndex;
  17. parameter bool bTruncate;
  18. parameter real iEpsCrossDistance;
  19.  
  20.     void init(void)
  21.     {
  22.         if (iInside==1 || iInside==2)
  23.         {
  24.             z_min=1000000;
  25.         }
  26.         if (iInside==2)
  27.         {        
  28.             current_iter=1;
  29.             min_iter=1;
  30.         }
  31.         if (iInside==4)
  32.         {
  33.             iEpsilonCross=0; // 0 means, nothing has been done...
  34.         }
  35.     }
  36.     void loop(void)
  37.     {
  38.         if (iInside==1) // bof60
  39.         {
  40.             zmodulo=|z|;
  41.             if (zmodulo<z_min)
  42.             {
  43.                 z_min=zmodulo;
  44.             }
  45.         }
  46.         else if (iInside==2) // bof61
  47.         {
  48.             current_iter=current_iter+1;
  49.             zmodulo=|z|;
  50.             if (zmodulo<z_min)
  51.             {
  52.                 z_min=zmodulo;
  53.                 min_iter=current_iter;
  54.             }
  55.         }
  56.         else if (iInside==4) // epsilon cross
  57.         {
  58.             if (iEpsilonCross==0)
  59.             {
  60.                 if (abs(real(z))<iEpsCrossDistance)
  61.                 {
  62.                     iEpsilonCross=2;
  63.                 }
  64.                 if (abs(imag(z))<iEpsCrossDistance)
  65.                 {
  66.                     iEpsilonCross=4;
  67.                 }
  68.             }
  69.  
  70.             current_iter=current_iter+1;
  71.             zmodulo=|z|;
  72.             if (zmodulo<z_min)
  73.             {
  74.                 z_min=zmodulo;
  75.                 min_iter=current_iter;
  76.             }
  77.         }
  78.     }
  79.     void final(void)
  80.     {
  81.         if (iInside==0)
  82.         {
  83.             if (iColorIndex==-1)
  84.             {
  85.                 index=maxiter;
  86.             }
  87.             else
  88.             {
  89.                 index=iColorIndex;
  90.             }
  91.         }
  92.         else if (iInside==1) // bof60
  93.         {
  94.             index = sqrt(z_min) * 75;
  95.         }
  96.         else if (iInside==2) // bof61
  97.         {
  98.             index=min_iter;
  99.         }
  100.         else if (iInside==3) // zmag
  101.         {
  102.             index = |z| * trunc(maxiter / 2) + 1;
  103.         }
  104.         else if (iInside==4) // Epsilon cross
  105.         {
  106.             index = iEpsilonCross;
  107.         }
  108.         if (bTruncate)
  109.         {
  110.             index=trunc(index);
  111.         }
  112.         index=(index%256)/256;
  113.     }
  114.     void description(void)
  115.     {
  116.         this.title="Inside";
  117.         this.helpfile="http://www.chaospro.de/";
  118.     
  119.         iInside.caption="Inside Coloring";
  120.         iInside.hint="This option specifies the algorithm to use for inside coloring";
  121.         iInside.enum="<nnn>\nbof60\nbof61\nzmag\nepscross";
  122.         iInside.default=0;
  123.         
  124.         iColorIndex.caption="Color Index";
  125.         iColorIndex.hint="Specifies the color to use. -1 means 'maxiter'. Parameter is used only if Inside-Coloring is set to <nnn>";
  126.         iColorIndex.default=1.0;
  127.         iColorIndex.min=-1.0;
  128.         iColorIndex.max=255.0;
  129.         
  130.         bTruncate.caption="Truncate";
  131.         bTruncate.hint="If set, the resulting color index gets truncated to the nearest color index. Otherwise (i.e. normal behaviour of ChaosPro) the two neighboured colors would be interpolated.";
  132.         bTruncate.default=true;                          
  133.         
  134.         iEpsCrossDistance.caption="Distance";
  135.         iEpsCrossDistance.hint="Valid only for epsilon cross coloring: Specifies the distance from the axis";
  136.         iEpsCrossDistance.default=0.01;
  137.         iEpsCrossDistance.min=0.0000000000000000001;
  138.         iEpsCrossDistance.max=100000;
  139.     }
  140. }
  141.  
  142. Outside {
  143. parameter int iOutside;
  144. parameter real iColorIndex;
  145. parameter bool bTruncate;
  146.  
  147.     void final(void)
  148.     {
  149.         index=1+numiter;
  150.         if (iOutside==0)
  151.         {
  152.             index=iColorIndex;
  153.         }
  154.         else if (iOutside==1)
  155.         {
  156.             index=numiter;
  157.         }
  158.         else if (iOutside==2)
  159.         {
  160.             index=index+7+real(z);
  161.         }
  162.         else if (iOutside==3)
  163.         {
  164.             index=index+7+imag(z);
  165.         }
  166.         else if (iOutside==4)
  167.         {
  168.             index=index*real(z)*imag(z);
  169.         }
  170.         else if (iOutside==5)
  171.         {
  172.             index=index+real(z)+imag(z);
  173.         }
  174.         else if (iOutside==6)
  175.         {
  176.             index=abs(atan2(z)*180/pi);
  177.         }
  178.         if (bTruncate)
  179.         {
  180.             index=trunc(index);
  181.         }
  182.         index=(index%256)/256;
  183.     }
  184.     void description(void)
  185.     {
  186.         this.title="Outside";
  187.         this.helpfile="http://www.chaospro.de/";
  188.  
  189.         iOutside.caption="Outside Coloring";
  190.         iOutside.hint="This option specifies the algorithm to use for outside coloring";
  191.         iOutside.enum="<nnn>\niter\nreal\nimag\nmult\nsumm\natan";
  192.         iOutside.default=1;
  193.  
  194.         iColorIndex.caption="Color Index";
  195.         iColorIndex.hint="Specifies the color to use. Parameter is used only if Outside-Coloring is set to <nnn>";
  196.         iColorIndex.default=1;
  197.         iColorIndex.min=0;
  198.         iColorIndex.max=255;
  199.  
  200.         bTruncate.caption="Truncate";
  201.         bTruncate.hint="If set, the resulting color index gets truncated to the nearest color index. Otherwise (i.e. normal behaviour of ChaosPro) the two neighboured colors would be interpolated.";
  202.         bTruncate.default=true;                          
  203.     }
  204. }
  205.  
  206.